package com.tang.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tang.service.IDepartmentService;
import com.tang.vo.DepartmentVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fulin.tang@unisoc.com
 * @since 2021-07-27
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/department")
public class DepartmentController {

    private final IDepartmentService departmentService;
    
    @GetMapping(value = "/list")
    IPage<DepartmentVo> query(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {

        Page<DepartmentVo> page = new Page<>(pageNo, pageSize);
        return departmentService.getPage(page);
    }

}
